package org.nobject.common.fan.datagen;

import java.awt.Color;
import java.awt.Font;
import java.awt.image.BufferedImage;

import org.nobject.common.image.DrawUtils;

public class LogoGen {
	
	public static String [] fontNames=new String[]{"仿宋_GB2312","华文中宋","华文仿宋","华文宋体","华文彩云","华文新魏","华文楷体","华文琥珀","华文细黑","华文行楷","华文隶书","宋体","宋体-PUA","幼圆","微软雅黑","新宋体","方正姚体","方正舒体","楷体_GB2312","迷你简汉真广标","隶书","黑体"};
	
	/**
	 * @param companyName
	 * @param filename
	 * @param bgImage
	 * @param color
	 * @param font
	 */
	public static void gen(String companyName,String filename,BufferedImage bgImage,Color color,Font font){
		if(color==null){
			int c1=RandomGen.random.nextInt(255);
			int c2=RandomGen.random.nextInt(255);
			int c3=RandomGen.random.nextInt(255);
			color=new Color(c1,c2,c3);
		}
		
		if(font==null){
			font=new Font(fontNames[RandomGen.random.nextInt(fontNames.length)],RandomGen.random.nextInt(3), 16+RandomGen.random.nextInt(10));
		}
		try {
			int width=179;
			int height=48;
			DrawUtils.draw(companyName,bgImage,color,font, filename,width,height);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
}
